import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
const DEFAULT_LAYOUT = () => import('@/views/home/index.vue');
 const permissionRouter: RouteRecordRaw[] = [
    {
        path: '/user',
        name: 'user',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '个人中心',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:1,
            roles: ['admin','doctor','nurse'],
        },
        children: [
            {
                path: 'info',
                name: 'Info',
                component: () => import('@/views/user/info.vue'),
                  meta: {
                    locale: '个人信息',
                    requiresAuth: true,
                    roles: ['admin','doctor','nurse'],
                    keepAlive: true //设置页面是否需要使用缓存
                  },
            },
            {
                path: 'setting',
                name: 'Setting',
                component: () => import('@/views/user/setting.vue'),
                  meta: {
                    locale: '设置',
                    requiresAuth: true,
                    roles: ['admin','doctor','nurse'],
                  },
            },
        ],
    },
    {
        path: '/doctor',
        name: 'doctor',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '医生管理',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:2,
            roles: ['admin','doctor'],
        },
        children: [
            {
                path: 'doctorinfo',
                name: 'Doctorinfo',
                component: () => import('@/views/doctor/DoctorManagement.vue'),
                  meta: {
                    locale: '医生信息',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'doctorservice',
                name: 'Doctorservice',
                component: () => import('@/views/doctor/DoctorService.vue'),
                  meta: {
                    locale: '医生服务',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'doctorbook',
                name: 'Doctorbook',
                component: () => import('@/views/doctor/DoctorBook.vue'),
                  meta: {
                    locale: '医生预约',
                    requiresAuth: true,
                    roles: ['admin','doctor'],
                  },
            },
        ],
    },
    {
        path: '/nurse',
        name: 'Nurse',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '护士管理',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:3,
            roles: ['admin','nurse'],
        },
        children: [
            {
                path: 'nurseinfo',
                name: 'Nurseinfo',
                component: () => import('@/views/nurse/NurseManagement.vue'),
                  meta: {
                    locale: '护士信息',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'nurseservice',
                name: 'Nurseservice',
                component: () => import('@/views/nurse/NurseService.vue'),
                  meta: {
                    locale: '护士服务',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'nursebook',
                name: 'Nursebook',
                component: () => import('@/views/nurse/NurseBook.vue'),
                  meta: {
                    locale: '护士预约',
                    requiresAuth: true,
                    roles: ['admin','nurse'],
                  },
            },
        ],
    },
    {
        path: '/department',
        name: 'Department',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '科室管理',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:3,
            roles: ['admin'],
        },
        children: [
            {
                path: 'infomanagement',
                name: 'InfoManagement',
                component: () => import('@/views/department/InfoManagement.vue'),
                  meta: {
                    locale: '科室信息',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'classify',
                name: 'Classify',
                component: () => import('@/views/department/classify.vue'),
                  meta: {
                    locale: '科室分类',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
        ],
    },
    {
        path: '/order',
        name: 'Order',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '挂号管理',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:3,
            roles: ['admin','doctor'],
        },
        children: [
            {
                path: 'orderManagement',
                name: 'OrderManagement',
                component: () => import('@/views/order/orderManagement.vue'),
                  meta: {
                    locale: '挂号问诊',
                    requiresAuth: true,
                    roles: ['admin','doctor'],
                  },
            },
        ],
    },
    {
        path: '/hospital',
        name: 'Hospital',
        component: DEFAULT_LAYOUT, // 注意这里要带上 文件后缀.vue
        meta: {
            locale: '医院管理',
            requiresAuth: true,
            icon: 'icon-dashboard',
            order:3,
            roles: ['admin'],
        },
        children: [
            {
                path: 'carousel',
                name: 'Carousel',
                component: () => import('@/views/hospital/carousel.vue'),
                  meta: {
                    locale: '轮播图',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'inquiries',
                name: 'Inquiries',
                component: () => import('@/views/hospital/hospital.vue'),
                  meta: {
                    locale: '医院咨讯',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
            {
                path: 'hospitalinfo',
                name: 'Hospitalinfo',
                component: () => import('@/views/hospital/hospitalinfo.vue'),
                  meta: {
                    locale: '医院信息',
                    requiresAuth: true,
                    roles: ['admin'],
                  },
            },
        ],
    },
]
export default permissionRouter;